package com.atguigui.leetcode;

/**
 * 1450.在既定时间做作业的学生人数
 * Project: leetcode
 * Package: com.atguigui.leetcode
 * Version: 1.0
 * <p>
 * Created by WJX on 2022/8/19 9:28
 */
public class P1450NumberOfStudentsDoingHomeworkAtAGivenTime {
    public static void main(String[] args) {
        Solution solution = new P1450NumberOfStudentsDoingHomeworkAtAGivenTime().new Solution();
        // TO TEST
    }

    //leetcode submit region begin(Prohibit modification and deletion)
    class Solution {
        /**
         * 枚举法
         *
         * @param startTime
         * @param endTime
         * @param queryTime
         * @return
         */
        public int busyStudent(int[] startTime, int[] endTime, int queryTime) {
            int ans = 0;

            int n = startTime.length;
            for (int i = 0; i < n; i++) {
                int start = startTime[i];
                int end = endTime[i];
                if (start <= queryTime && end >= queryTime) {
                    ans++;
                }
            }

            return ans;
        }
    }
}
